package com.powernode.feign;

import com.powernode.domain.Prod;
import com.powernode.feign.sentinel.StoreFeignProdSentinel;
import com.powernode.model.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Description:
 * @Author: Tong Ziyu
 * @Date: 2025/4/26 21:37
 */
@Component
@FeignClient(value = "product-service", fallback = StoreFeignProdSentinel.class)
public interface StoreFeignProd {

    /**
     * 注意:这里的方法签名要和远程的签名保持一致
     * feign使用步骤:
     *  1.加入依赖
     *  2.在启动类上添加注解 @EnableFeignClients
     *  2.编写接口
     *  3.编写熔断机制
     *  4.在提供方编写controller,方法签名要和消费方接口的保持一致
     *
     * @param ids
     * @return
     */
    @GetMapping("prod/prod/getProdListByIds")
    public Result<List<Prod>> getProdListByProdIds(@RequestParam List<Long> ids);
}
